package com.kevin.concurrent;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Kevin Liu
 * @date 2020/10/7 4:54 下午
 */
public class ThreadLocalTest {

    private  static  ThreadLocal<Map<String,Object>> threadLocal = ThreadLocal.withInitial(HashMap::new);
    private  static ThreadLocal<Map<String,Object>> threadLocal2 = new InheritableThreadLocal<Map<String, Object>>(){
//        @Override
//        protected Map<String,Object> initialValue() {
//            return new HashMap<>();
//        }
    };

    public static void main(String[] args) {
        Map<String, Object> maps = threadLocal.get();
        maps.put("123",123);
        maps = threadLocal.get();
        System.out.println(maps);
    }
}
